﻿using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WebApplication1
{
    public partial class Add : System.Web.UI.Page
    {
        private SqlHelper helper = new SqlHelper();
        protected void Page_Load(object sender, EventArgs e)
        {
            
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            string name = TextBox1.Text;
            string password = TextBox2.Text;
            string email = TextBox3.Text;
            string intro = TextBox4.Text;

            string sql = "insert into StudentInfo(stu_name,password,email,intro) values (@name,@pwd,@email,@intro)";

            SqlParameter[] sqls = 
            {
                new SqlParameter("@name",name),
                new SqlParameter("@pwd",password),
                new SqlParameter("@email",email),
                new SqlParameter("@intro",intro)
            };

            if (helper.Execute(sql,sqls)==true)
            {
                Literal1.Text = "添加成功"+"<a href='WebForm1.aspx'>去查看》》</a>";
            }


        }
    }
}